<?php

class Application_Form_Contato extends Zend_Form
{

    public function init()
    {
        $front = Zend_Controller_Front::getInstance();
        $controller = $front->getRequest()->getControllerName();
        $url = $front->getBaseUrl().'/'.$controller;
        
        $this->setName('form_'.$controller);
        
        //$this->setAction($url.'/enviar');
        
        $el = new Zend_Form_Element_Text('nome');
        $el->setLabel('Nome')
                ->setRequired(true)
                ->addFilters(array('StringTrim','StripTags'))
                ->addValidator('NotEmpty');
        $el->setAttrib('required','');
        $this->addElement($el);
        
        $el = new Zend_Form_Element_Text('email');
        $el->setLabel('E-mail')
                ->setRequired(true)
                ->addFilters(array('StringTrim','StripTags'))
                ->addValidator('EmailAddress', TRUE )
                ->addValidator('NotEmpty');
        $el->setAttrib('class','email');
        $el->setAttrib('required','email');
        $this->addElement($el);
        
        $el = new Zend_Form_Element_Text('assunto');
        $el->setLabel('Assunto')
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');
        $el->setAttrib('required','');
        $this->addElement($el);
        
        $el = new Zend_Form_Element_Textarea('mensagem');
        $el->setLabel('Mensagem')
        ->setAttrib('rows', '10')
        ->setRequired(true)
        ->addFilters(array('StringTrim','StripTags'))
        ->addValidator('NotEmpty');
        $el->setAttrib('required','');
        $this->addElement($el);
        
        $btn = new Zend_Form_Element_Button('submit');
        $btn->setLabel('Enviar');
        $btn->setAttrib('type', 'submit');
        $this->addElement($btn);
        
    }


}

